<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
                  ->withRouting(
                      web: __DIR__ . '/../routes/web.php',
                      api: __DIR__ . '/../routes/api.php',
                      commands: __DIR__ . '/../routes/console.php',
                      health: '/up', apiPrefix: 'app',
                      then: function () {
                      })
                  ->withMiddleware(callback: function (Middleware $middleware) {
                      $middleware->encryptCookies(except: [
                          'cookie_name',
                      ]);
//            $middleware->priority([
//                GoodsMiddleware::class,
//                FirstMiddleware::class,
//            ]);
//            $middleware->alias([
//                'goods' => GoodsMiddleware::class,
//                'first' => FirstMiddleware::class,
//            ]);
//            $middleware->append(GoodsMiddleware::class);
//            $middleware->prepend(FirstMiddleware::class);
//            $middleware->use([
//                FirstMiddleware::class,
//            ]);
//            $middleware->appendToGroup('middleware-group-one', [
//                FirstMiddleware::class,
//                GoodsMiddleware::class,
//            ]);
//            $middleware->prependToGroup('middleware-group-two', [
//                GoodsMiddleware::class,
//                FirstMiddleware::class,
//            ]);
//            $middleware->web(append: [GoodsMiddleware::class]);
//            $middleware->api(
//                prepend: [FirstMiddleware::class],
//                remove: [FirstMiddleware::class],
//                replace: [StartSession::class => GoodsMiddleware::class],
//            );
//            $middleware->group('api', [
//                FirstMiddleware::class,
//                GoodsMiddleware::class,
//            ]);
                  })
                  ->withExceptions(function (Exceptions $exceptions) {
                      //
                  })
                  ->create()
;
